package com.dl.test.controller;

import com.dl.dlcommon.annotation.Login;
import com.dl.dlcommon.annotation.MethodInfo;
import com.dl.dlcommon.controller.BaseController;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author DL
 * @create 2022-12-16 15:17
 */
@Slf4j
@Login
@MethodInfo(time = true)
@RestController
@RequestMapping("/")
public class AuthController extends BaseController {

    @GetMapping("/login")
    public String getHeader() {
        return request.getParameter("test");
    }

    @GetMapping("/login2")
    public Map<String,Object> getHeader2(HttpServletRequest request) {
        String test = request.getHeader("test");
        System.out.println("test = " + test);
        HashMap<String, Object> map = new HashMap<>();
        map.put("test","value");
        return map;
    }

    @GetMapping("/login3")
    public List<String> getHeader3() {
        //System.out.println("login3");
        List<String> strings = List.of("1");
        System.out.println("strings = " + strings);
        return strings;
    }
}
